home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Utilities / Calc / xstdarg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-24  |  904 b   |  48 lines  |  [TEXT/????]

  1. /*
  2.  * Copyright (c) 1992 David I. Bell
  3.  * Permission is granted to use, distribute, or modify this source,
  4.  * provided that this copyright notice remains intact.
  5.  */
  6.  
  7. #include "args.h"
  8.  
  9. #ifndef STDARG_H
  10. #define STDARG_H
  11.  
  12. #ifdef VARARGS
  13.  
  14. #include <varargs.h>
  15.  
  16. #else /*VARARG*/
  17.  
  18. #ifdef STDARG
  19.  
  20. #if defined(__STDC__)
  21. #include <stdarg.h>
  22. #else
  23. %;%;%  BOGUS DEFINE!  Must use ANSI C when STDARG is defined  %;%;%
  24. #endif
  25.  
  26. #else /*STDARG*/
  27.  
  28. /*
  29.  * SIMULATE_STDARG
  30.  *
  31.  * WARNING: This type of stdarg makes assumptions about the stack
  32.  *         that may not be true on your system.  You may want to
  33.  *        define STDARG (if using ANSI C) or VARARGS.
  34.  */
  35.  
  36. typedef char *va_list;
  37. #define va_start(ap,parmn) (void)((ap) = (char*)(&(parmn) + 1))
  38. #define va_end(ap) (void)((ap) = 0)
  39. #define va_arg(ap, type) \
  40.     (((type*)((ap) = ((ap) + sizeof(type))))[-1])
  41.  
  42. #endif /*STDARG*/
  43. #endif /*VARARG*/
  44.  
  45. #endif
  46.  
  47. /* END CODE */
  48.